Bokeh has a few examples up in the bokeh gallery, but there's a rich, and somewhat hidden, resource - the bokeh examples directory.
Here we'll look at how to run and play with the bokeh examples.
In [9]:
from bokeh import __version__
__version__
Out[9]:
There are a few of options for getting the examples. In increasing order of difficulty:
I have made zip files of the examples for recent releases of bokeh:
I will keep adding new ones on the examples page
From the command line you can find where bokeh is running from, and from this we can find our examples. First find bokeh with which bokeh
:
(bokeh)➜ pages git:(master) ✗ which bokeh
/Users/birdsarah/miniconda3/envs/bokeh/bin/bokeh
Next go to the directory one above bin. In my case that's:
$ cd /Users/birdsarah/miniconda3/envs/bokeh
In that directory you should find a directory called Examples
. This is where all the bokeh examples live.
If you're hacking on bokeh bokeh you may want to run the examples against your local version of bokeh.
Bokeh has a default setting which is helpful for regular bokeh users but can confuse new Bokeh developers. Bokeh has two parts to it the python part (from bokeh import ...
) and the javascript part (aka bokehjs). By default bokeh uses a pre-built version of bokehjs that lives on our cdn. This is super useful for users because it means that the html they produce isn't full of the bokehjs library. However, the pre-built version of bokehjs will be the latest release version and is almost certainly not compatible with bokeh master which we're downloading an running locally.
Which version of bokehjs we're using is managed through bokeh.resources
and you can read more here: http://bokeh.pydata.org/en/dev/docs/reference/resources.html
We have a set of environment variables that we can set so that bokeh just does the right thing when we're developing. You can see a complete list here: http://bokeh.pydata.org/en/dev/docs/dev_guide/env_vars.html
I often use BOKEH_DEV=true
but that can have the side effect of running